<!DOCTYPE html>
<html lang="zh-cn">
{% load static %}

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="{% static 'bl/css/pintuer.css' %}">
    <link rel="stylesheet" href="{% static 'bl/css/admin.css' %}">
    <script src="{% static 'bl/js/jQuery.js' %}"></script>
    <script src="{% static 'bl/js/pintuer.js' %}"></script>

</head>
<body>
<form method="post" action="" id="listform">
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
    <div class="padding border-bottom">
      <ul class="search" style="padding-left:10px;">
        <li> <a class="button border-main icon-plus-square-o" href="../page/"> 添加内容</a> </li>
{#        <li>搜索：</li>#}
{#        <li>首页#}
{#          <select name="s_ishome" class="input" onchange="changesearch()" style="width:60px; line-height:17px; display:inline-block">#}
{#            <option value="">选择</option>#}
{#            <option value="1">是</option>#}
{#            <option value="0">否</option>#}
{#          </select>#}
{#          &nbsp;&nbsp;#}
{#          推荐#}
{#          <select name="s_isvouch" class="input" onchange="changesearch()"  style="width:60px; line-height:17px;display:inline-block">#}
{#            <option value="">选择</option>#}
{#            <option value="1">是</option>#}
{#            <option value="0">否</option>#}
{#          </select>#}
{#          &nbsp;&nbsp;#}
{#          置顶#}
{#          <select name="s_istop" class="input" onchange="changesearch()"  style="width:60px; line-height:17px;display:inline-block">#}
{#            <option value="">选择</option>#}
{#            <option value="1">是</option>#}
{#            <option value="0">否</option>#}
{#          </select>#}
{#        </li>#}
{#        <if condition="$iscid eq 1">#}
{#          <li>#}
{#            <select name="cid" class="input" style="width:200px; line-height:17px;" onchange="changesearch()">#}
{#              <option value="">请选择分类</option>#}
{#              <option value="">产品分类</option>#}
{#              <option value="">产品分类</option>#}
{#              <option value="">产品分类</option>#}
{#              <option value="">产品分类</option>#}
{#            </select>#}
{#          </li>#}
{#        </if>#}
{#        <li>#}
{#          <input type="text" placeholder="请输入搜索关键字" name="keywords" class="input" style="width:250px; line-height:17px;display:inline-block" />#}
{#          <a href="javascript:void(0)" class="button border-main icon-search" onclick="changesearch()" > 搜索</a></li>#}
      </ul>
    </div>
    <table class="table table-hover text-center">
      <tr>
        <th width="100" style="text-align:left; padding-left:20px;">ID</th>
{#        <th width="10%">排序</th>#}
{#        <th>图片</th>#}
        <th>名称</th>
        <th>内容</th>
{#        <th>分类名称</th>#}
        <th width="10%">创建时间</th>
        <th width="10%">更新时间</th>
        <th width="310">操作</th>
      </tr>
      <volist name="list" id="vo">
{#          <ul class="goods_type_list clearfix">#}
{#                {% for goods in goods_li %}#}
{#				<li>#}
{#					<a href="/goods/{{ goods.id }}/"><img src="{% static goods.img_url %}"></a>#}
{#					<h4><a href="/goods/{{ goods.id }}/">{{ goods.goods_name }}</a></h4>#}
{#					<div class="operate">#}
{#						<span class="prize">￥{{ goods.goods_price }}</span>#}
{#						<span class="unit">{{ goods.goods_price }}/{{ goods.goods_unite }}</span>#}
{#						<a href="#" class="add_goods" title="加入购物车"></a>#}
{#					</div>#}
{#				</li>#}
{#                {% endfor %}#}
{##}
{#          </ul>#}
          {% for blog in blog_list %}
              <tr>
                  <td style="text-align:left; padding-left:20px;"><input type="checkbox" name="id[]" value="" />
                   {{ blog.id }}</td>
{#                  <td><input type="text" name="sort[1]" value="1" style="width:50px; text-align:center; border:1px solid #ddd; padding:7px 0;" /></td>#}
{#                  <td width="10%"><img src="images/11.jpg" alt="" width="70" height="50" /></td>#}
{#                  <td>{{ blog.title }}<a href="./{{ blog.id }}"></a></td>#}
{#                  <a href="../{{book.id}}/">{{book.btitle}}</a>#}
                 <td> <a href="./{{ blog.id }}/">{{ blog.title }}</a></td>
                  <td>{{ blog.content }}</td>
{#                  <td><font color="#00CC99">首页</font></td>#}
                  <td>{{ blog.create_time }}</td>
                  <td>{{ blog.update_time }}</td>
{#                  <td><div class="button-group"> <a class="button border-main" href="add.html"><span class="icon-edit"></span> 修改</a> <a class="button border-red" href="javascript:void(0)" onclick="return del({{ blog.id }})"><span class="icon-trash-o"></span> 删除</a> </div></td>#}
                  <td><div class="button-group"> <a class="button border-main" href="../list_edit_blog/{{ blog.id }}/" onclick="return edit({{ blog.id }})"><span class="icon-edit"></span> 修改</a> <a class="button border-red" href="javascript:void(0)" onclick="return del({{ blog.id }})"><span class="icon-trash-o"></span> 删除</a> </div></td>
              </tr>
          {% endfor %}

{#      <tr>#}
{#        <td style="text-align:left; padding:19px 0;padding-left:20px;"><input type="checkbox" id="checkall"/>#}
{#          全选 </td>#}
{#        <td colspan="7" style="text-align:left;padding-left:20px;"><a href="javascript:void(0)" class="button border-red icon-trash-o" style="padding:5px 15px;" onclick="DelSelect()"> 删除</a> <a href="javascript:void(0)" style="padding:5px 15px; margin:0 10px;" class="button border-blue icon-edit" onclick="sorts()"> 排序</a> 操作：#}
{#          <select name="ishome" style="padding:5px 15px; border:1px solid #ddd;" onchange="changeishome(this)">#}
{#            <option value="">首页</option>#}
{#            <option value="1">是</option>#}
{#            <option value="0">否</option>#}
{#          </select>#}
{#          <select name="isvouch" style="padding:5px 15px; border:1px solid #ddd;" onchange="changeisvouch(this)">#}
{#            <option value="">推荐</option>#}
{#            <option value="1">是</option>#}
{#            <option value="0">否</option>#}
{#          </select>#}
{#          <select name="istop" style="padding:5px 15px; border:1px solid #ddd;" onchange="changeistop(this)">#}
{#            <option value="">置顶</option>#}
{#            <option value="1">是</option>#}
{#            <option value="0">否</option>#}
{#          </select>#}
{#          &nbsp;&nbsp;&nbsp;#}
{#          #}
{#          移动到：#}
{#          <select name="movecid" style="padding:5px 15px; border:1px solid #ddd;" onchange="changecate(this)">#}
{#            <option value="">请选择分类</option>#}
{#            <option value="">产品分类</option>#}
{#            <option value="">产品分类</option>#}
{#            <option value="">产品分类</option>#}
{#            <option value="">产品分类</option>#}
{#          </select>#}
{#          <select name="copynum" style="padding:5px 15px; border:1px solid #ddd;" onchange="changecopy(this)">#}
{#            <option value="">请选择复制</option>#}
{#            <option value="5">复制5条</option>#}
{#            <option value="10">复制10条</option>#}
{#            <option value="15">复制15条</option>#}
{#            <option value="20">复制20条</option>#}
{#          </select></td>#}
{#      </tr>#}
{#      <tr>#}
      <tr>
        <td colspan="8">
          <div class="pagelist">
            {% if blog_list.has_previous %}
                <a href="./?page=1">首页</a>

                <a href="./?page={{ blog_list.previous_page_number }}">上一页</a>
            {% else %}
            <a href="" style="display:none">上一页</a>
            {% endif %}

            {% for num in paginator.page_range %}

              {% if num == currentPage %}
              <span class="current">{{ num }}</span>
              {% else %}
                <a href="./?page={{ num }}">{{ num }}</a>
              {% endif %}
            {% endfor %}
              {% if blog_list.has_next %}
                    <a href="./?page={{ blog_list.next_page_number }}">下一页</a>
                    <a href="./?page={{ blog_list.end_index }}">尾页</a>
              {% endif %}
          </div>
        </td>
      </tr>
{#        <td colspan="8"><div class="pagelist"> <a href="">上一页</a> <span class="current">1</span><a href="">2</a><a href="">3</a><a href="">下一页</a><a href="">尾页</a> </div></td>#}
      </tr>
    </table>
  </div>
</form>
<script type="text/javascript">

//搜索
function changesearch(){	
		
}


function btn(){

    username = $("[name=username]").val()
    password = $("[name=password]").val()
    remember = $("[name=remember]").val()
    console.log(username,password)
    if(username!="" && password!=""){
        $.ajax({
            url:"/blog/login_check/",
            type:"post",
            contentType: "application/json; charset=utf-8",
            data:JSON.stringify({'username':username,'password':password, 'remember':remember}),
            success:function(data){
                if(data.res == 1){
                    location.href = "../"
                }else{
                      $("[name=username]").text('用户名或密码错误').show()
                  }
            }

        })
    }

}


//单个删除
function del(id){
	if(confirm("您确定要删除吗?")){
{#        id = $("[name=password]").val()#}
{#        remember = $("[name=remember]").val()#}
{#        console.log(username,password)#}
        if(id){
            $.ajax({
                url:"/blog/delete_blog/",
                type:"post",
                contentType: "application/json; charset=utf-8",
                data:JSON.stringify({'id':id}),
                success:function(data){
                    if(data.res == 1){
                        location.href = "../blog_list/"

                    }else{
                          $("[name=username]").text('用户名或密码错误').show()
                      }
                }

            })
        }
	}
}

{#//全选#}
{#$("#checkall").click(function(){ #}
{#  $("input[name='id[]']").each(function(){#}
{#	  if (this.checked) {#}
{#		  this.checked = false;#}
{#	  }#}
{#	  else {#}
{#		  this.checked = true;#}
{#	  }#}
{#  });#}
{#{)#}
{##}
{#//批量删除#}
{#function DelSelect(){#}
{#	var Checkbox=false;#}
{#	 $("input[name='id[]']").each(function(){#}
{#	  if (this.checked==true) {		#}
{#		Checkbox=true;	#}
{#	  }#}
{#	});#}
{#	if (Checkbox){#}
{#		var t=confirm("您确认要删除选中的内容吗？");#}
{#		if (t==false) return false;		#}
{#		$("#listform").submit();		#}
{#	}#}
{#	else{#}
{#		alert("请选择您要删除的内容!");#}
{#		return false;#}
{#	}#}
{#}#}
{##}
{#//批量排序#}
{#function sorts(){#}
{#	var Checkbox=false;#}
{#	 $("input[name='id[]']").each(function(){#}
{#	  if (this.checked==true) {		#}
{#		Checkbox=true;	#}
{#	  }#}
{#	});#}
{#	if (Checkbox){	#}
{#		#}
{#		$("#listform").submit();		#}
{#	}#}
{#	else{#}
{#		alert("请选择要操作的内容!");#}
{#		return false;#}
{#	}#}
{#}#}
{##}
{##}
{#//批量首页显示#}
{#function changeishome(o){#}
{#	var Checkbox=false;#}
{#	 $("input[name='id[]']").each(function(){#}
{#	  if (this.checked==true) {		#}
{#		Checkbox=true;	#}
{#	  }#}
{#	});#}
{#	if (Checkbox){#}
{#		#}
{#		$("#listform").submit();	#}
{#	}#}
{#	else{#}
{#		alert("请选择要操作的内容!");		#}
{#	#}
{#		return false;#}
{#	}#}
{#}#}
{##}
{#//批量推荐#}
{#function changeisvouch(o){#}
{#	var Checkbox=false;#}
{#	 $("input[name='id[]']").each(function(){#}
{#	  if (this.checked==true) {		#}
{#		Checkbox=true;	#}
{#	  }#}
{#	});#}
{#	if (Checkbox){#}
{#		#}
{#		#}
{#		$("#listform").submit();	#}
{#	}#}
{#	else{#}
{#		alert("请选择要操作的内容!");	#}
{#		#}
{#		return false;#}
{#	}#}
{#}#}
{##}
{#//批量置顶#}
{#function changeistop(o){#}
{#	var Checkbox=false;#}
{#	 $("input[name='id[]']").each(function(){#}
{#	  if (this.checked==true) {		#}
{#		Checkbox=true;	#}
{#	  }#}
{#	});#}
{#	if (Checkbox){		#}
{#		#}
{#		$("#listform").submit();	#}
{#	}#}
{#	else{#}
{#		alert("请选择要操作的内容!");		#}
{#	#}
{#		return false;#}
{#	}#}
{#}#}
{##}
{##}
{#//批量移动#}
{#function changecate(o){#}
{#	var Checkbox=false;#}
{#	 $("input[name='id[]']").each(function(){#}
{#	  if (this.checked==true) {		#}
{#		Checkbox=true;	#}
{#	  }#}
{#	});#}
{#	if (Checkbox){		#}
{#		#}
{#		$("#listform").submit();		#}
{#	}#}
{#	else{#}
{#		alert("请选择要操作的内容!");#}
{#		#}
{#		return false;#}
{#	}#}
{#}#}
{##}
{#//批量复制#}
{#function changecopy(o){#}
{#	var Checkbox=false;#}
{#	 $("input[name='id[]']").each(function(){#}
{#	  if (this.checked==true) {		#}
{#		Checkbox=true;	#}
{#	  }#}
{#	});#}
{#	if (Checkbox){	#}
{#		var i = 0;#}
{#	    $("input[name='id[]']").each(function(){#}
{#	  		if (this.checked==true) {#}
{#				i++;#}
{#			}		#}
{#	    });#}
{#		if(i>1){ #}
{#	    	alert("只能选择一条信息!");#}
{#			$(o).find("option:first").prop("selected","selected");#}
{#		}else{#}
{#		#}
{#			$("#listform").submit();		#}
{#		}	#}
{#	}#}
{#	else{#}
{#		alert("请选择要复制的内容!");#}
{#		$(o).find("option:first").prop("selected","selected");#}
{#		return false;#}
{#	}#}
{#}#}

</script>
</body>
</html>